package com.ycy.smartcourseselection.controller;

import com.ycy.smartcourseselection.common.ResData;
import com.ycy.smartcourseselection.dto.courseManage.CoManagesDTO;
import com.ycy.smartcourseselection.entity.CoManage;
import com.ycy.smartcourseselection.service.CoManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "选课管理")
@RestController
@RequestMapping("/coManage")
public class CoManageController {
    @Resource
    private CoManageService coManageService;

    //判断选课状态(是否选课中)
    @GetMapping("/judgeIsBegin")
    @ApiOperation(value="选课 -- 判断选课状态",notes = "没有添加(在添加课程时，后台已添加)")
    public ResData<Boolean> judgeCoIsBegin(String courseId) {
        return coManageService.judgeCoIsBegin(courseId);
    }

    //修改
    @PostMapping("/save")
    @ApiOperation(value="选课 -- 开始选课(停选)",notes = "没有添加(在添加课程时，后台已添加)")
    public ResData<Boolean> saveCoManage(@RequestBody CoManage coManage) {
        return coManageService.saveCoManage(coManage);
    }

    //批量修改
    @PostMapping("/saveBatch")
    @ApiOperation(value="选课 -- 批量开始选课(停选)",notes = "没有添加(在添加课程时，后台已添加)")
    public ResData<Boolean> saveBatchCoManage(@RequestBody CoManagesDTO coManagesDTO) {
        return coManageService.saveBatchCoManage(coManagesDTO);
    }
}
